home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Libraries / Hi-Performance Trigs 1.0 / Tables⁄Demos / Time Trig.p < prev    next >
Encoding:
Text File  |  1992-12-06  |  2.1 KB  |  106 lines  |  [TEXT/PJMM]

  1. program TimeTrig;
  2.  
  3. { Time Trig XXXX programs. }
  4. { These programs were used to test the performance mentioned in appendix A of the         }
  5. { FastPerfTrigs documentation. The 030/881 version used a specially compiled version    }
  6. { of the library that is not supplied with this package sinc it is slower than the direct FPU }
  7. { calls. }
  8. {}
  9. { © 1992 by Christian Franz }
  10. {}
  11. {}
  12.  
  13.  
  14.     uses
  15.         FastPerfTrigs;
  16.  
  17.     const
  18.         thevalue = 42.18928;
  19.         Tries = 1000;
  20.  
  21.     var
  22.         Start, Stop, SysClick, FastClicks: LongInt;
  23.         i: longint;
  24.         x, y: real;
  25.         Trect: rect;
  26.  
  27. begin
  28.     SetRect(Trect, 0, 20, 512, 380);
  29.     SetTextRect(Trect);
  30.     ShowText;
  31.     if InitTrigs <> noerr then
  32.         writeln('Init error')
  33.     else
  34.         begin
  35.             Writeln('-------------');
  36.             Writeln('Performance Test. Tries : ', Tries, '. Compiled 68000 ');
  37.             writeln;
  38.             Write('Beginning : Sine - Test: System ');
  39.             Start := TickCount;
  40.             for i := 1 to Tries do
  41.                 begin
  42.                     x := sin(thevalue);
  43.                 end;
  44.             Stop := TickCount;
  45.             SysClick := Stop - Start;
  46.             write(SysClick);
  47.  
  48.             Write(' TableLookup :  ');
  49.             Start := TickCount;
  50.             for i := 1 to Tries do
  51.                 begin
  52.                     x := Fsin(thevalue);
  53.                 end;
  54.             Stop := TickCount;
  55.             FastClicks := Stop - Start;
  56.             write(FastClicks);
  57.             writeln;
  58.             writeln;
  59.  
  60.             Write('Beginning : Cosine - Test: System ');
  61.             Start := TickCount;
  62.             for i := 1 to Tries do
  63.                 begin
  64.                     x := cos(thevalue);
  65.                 end;
  66.             Stop := TickCount;
  67.             SysClick := Stop - Start;
  68.             write(SysClick);
  69.  
  70.             Write(' TableLookup :  ');
  71.             Start := TickCount;
  72.             for i := 1 to Tries do
  73.                 begin
  74.                     x := FCos(thevalue);
  75.                 end;
  76.             Stop := TickCount;
  77.             FastClicks := Stop - Start;
  78.             write(FastClicks);
  79.             writeln;
  80.             writeln;
  81.  
  82.             Write('Beginning : Tangens - Test: System ');
  83.             Start := TickCount;
  84.             for i := 1 to Tries do
  85.                 begin
  86.                     x := tan(thevalue);
  87.                 end;
  88.             Stop := TickCount;
  89.             SysClick := Stop - Start;
  90.             write(SysClick);
  91.  
  92.             Write(' TableLookup :  ');
  93.             Start := TickCount;
  94.             for i := 1 to Tries do
  95.                 begin
  96.                     x := FTan(thevalue);
  97.                 end;
  98.             Stop := TickCount;
  99.             FastClicks := Stop - Start;
  100.             write(FastClicks);
  101.             writeln;
  102.             writeln;
  103.             repeat
  104.             until button;
  105.         end;
  106. end.